package com.zhj.psi.core.tools;

import com.zhj.psi.core.config.PageRange;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

/**
 * Created by zhuhuijun on 2017/9/2 20:37
 */
public class PageHelper {
    public static Pageable buildPageRequest(PageRange pageRange){
        return new PageRequest(pageRange.getPage(), pageRange.getSize(), Sort.Direction.fromString(pageRange.getSortBy()),pageRange.getOrderBy());
    }
}
